package com.ics.atable.chat.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ics.atable.chat.model.entity.ChatMessage;
import com.ics.atable.chat.model.vo.history.ChatHistoryVO;
import org.springframework.ai.chat.memory.ChatMemory;

import java.time.LocalDateTime;

/**
 * chat message service interface
 *
 * @author haohongbin
 */
public interface ChatMessageService extends IService<ChatMessage> {

    /**
     * get chat message history by session id
     * @param sessionId session id
     * @param pageSize page size
     * @param lastCreateTime last create time
     * @return chat message history
     */
    Page<ChatHistoryVO> listChatHistory(String sessionId, int pageSize, LocalDateTime lastCreateTime);

    /**
     * load chat message history to memory
     * @param sessionId session id
     * @param maxCount max count
     * @return loaded count
     */
    int loadChatHistoryToMemory(String sessionId, ChatMemory chatMemory, int maxCount);
}
